package cn.edu.zzti.base.dao.jdbc.mapper;

import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.Map;

import org.apache.commons.lang.StringUtils;

public class RowMapper {
	public Object mapRow(ResultSet rs, int index) throws SQLException {
		Map<String, Object> rowMap = new HashMap<String, Object>();
		ResultSetMetaData meta = rs.getMetaData();
		for (int i = 1; i <= meta.getColumnCount(); i++) {
			rowMap.put(StringUtils.lowerCase(meta.getColumnName(i)),
					rs.getObject(i));
		}
		return rowMap;
	}

}
